<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserExtractsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_extracts', function (Blueprint $table) {
            $table->id()->comment('用户提现记录表');
            $table->integer('user_id')->comment('用户id')->index();
            $table->string('real_name',100)->comment('用户真实名称');
            $table->string('wechat_name',100)->comment('微信昵称');
            $table->string('extract_type')->comment('提现类型 bank:银行卡 alipay:支付宝 wechat:微信');
            $table->string('bank_code',32)->nullable()->comment('银行卡号');
            $table->string('bank_address')->nullable()->comment('开户地址');
            $table->string('alipay_code',100)->nullable()->comment('支付宝账号');
            $table->decimal('extract_price',10,2)->comment('提现金额');
            $table->string('remarks')->nullable()->comment('提现备注');
            $table->decimal('balance',10,2)->comment('剩余金额');
            $table->string('fail_msg')->nullable()->comment('失败原因');
            $table->timestamp('fail_time')->nullable()->comment('失败时间');
            $table->string('status',100)->default('underreview')->comment('审核状态 fail:未通过 underreview:申请中 withdrawncash:已通过');
            $table->string('wechat_code',50)->nullable()->comment('微信号');
            $table->string('qrcode_url')->nullable()->comment('二维码地址');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_extracts');
    }
}
